const SET_CONFIG = 'SET_CONFIG'

export const state = () => ({
  setting: {
    live_status: 0,
    set_user_level: 0
  }
})

export const getters = {
  config: state => state
}

export const actions = {
  async getConfig({ commit }, { $api }) {
    try {
      const { data } = await $api.common.getConfig()
      commit(SET_CONFIG, data)
    } catch (error) {
      console.error('getConfig error', error)
    }
  }
}

export const mutations = {
  [SET_CONFIG](state, data) {
    state.setting = data
  }
}
